// components/GBTSearch/GBTSearch.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    searchstr: {     //input  值
      type: String,
      value: ''
    },
    searchflag: {
      type: Boolean,
      value: false,
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    searchstr: ""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //获得焦点
    getfocus() {
      this.setData({
        searchflag: true,
      })
    },
    //搜索输入
    searchList(e) {
      this.triggerEvent("search", e.detail);
    },
    //查询
    endsearchList(e) {
      // this.triggerEvent("endsearchList");
      const searchstr = e.detail.value;
      this.setData({ searchstr });
      this.triggerEvent("search", e.detail);
    },
    //失去焦点
    blursearch() {
      this.setData({
        searchflag: false,
      })
      // console.log('失去焦点')
    },
    // 取消
    cancelsearch() {
      this.setData({
        searchflag: false,
      })
      this.triggerEvent("cancel");
    },
    //清空搜索框
    activity_clear(e) {
      this.setData({ searchstr: "" });
      // this.props.onClear();
      // dd.alert({content:e.detail.value});
      this.triggerEvent("clear", e);
    },
  }
})
